package NIO;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.channels.DatagramChannel;
import java.nio.charset.Charset;

public class UDPclient {
    public static void main(String[] args) throws IOException, InterruptedException {
        DatagramChannel channel=DatagramChannel.open();
        InetSocketAddress address=new InetSocketAddress("localhost",9090);
        //channel.send(Charset.defaultCharset().encode("hello!"),address);
        channel.send(Charset.defaultCharset().encode("nihao123456789abcdefghg"),address);//超过了server中的buffer可接受最大值，多余的会被丢弃
    }
}
